export BASE_IDL_PATH=../xym_idl

export TD=-template-dir=${BASE_IDL_PATH}/tpl\kitex\server\standard
export TD_MULTI=-template-dir=${BASE_IDL_PATH}/tpl\kitex\server\multiple

update_common:
	go get github.com/grayscalecloud/kitexcommon@latest

add_thrift_replace:
	@echo "Adding replace directive for github.com/apache/thrift"
	@go mod edit -replace github.com/apache/thrift=github.com/apache/thrift@v0.13.0
	@echo "Replace directive added successfully"
	@go mod tidy

kitex_init:
	kitex -module testrpc ${TD} $(BASE_IDL_PATH)/idl/rpc/hello.thrift
	@go mod tidy
	make add_thrift_replace


kitex_multi:
	kitex -module testrpc ${TD_MULTI} $(BASE_IDL_PATH)/idl/rpc/hello.thrift

kitex_multi2:
	kitex -module testrpc ${TD_MULTI} $(BASE_IDL_PATH)/idl/rpc/hello3.thrift

# 运行所有手工编写的测试（排除生成的代码目录）
all_test:
	go test -v -race -coverprofile=coverage.out ./biz/... ./handler/... ./conf/...

# 只运行特定服务的测试
service_test:
	go test -v -race -coverprofile=coverage.out ./biz/service/...

# 显示测试覆盖率报告
show_coverage:
	go tool cover -html=coverage.out

# 在命令行显示测试覆盖率摘要
show_coverage_func:
	go tool cover -func=coverage.out